package com.example.feigntest.web;

import com.example.feigntest.service.HelloService;
import com.example.feigntest.vo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * Created by vincent on 2018/5/17.
 */
@ResponseBody
@Controller
@RequestMapping("feignController")
public class FeignController {
    @Autowired
    HelloService helloService;
    @GetMapping("feign-hello")
    public String hello(){
        return helloService.hello();
    }
    @GetMapping("feign-add")
    public Integer add(@RequestParam Integer a, @RequestParam Integer b){
        return helloService.add(a, b);
    }

    @GetMapping(value = "sayMyName")
    public Map<String, Object> sayMyName(){
        User user = new User();
        user.setName("vincent");
        user.setAge(18);
        return helloService.sayMyName(user);
    }
}
